package com.zhanghe.springsecurity.util;

import com.google.gson.Gson;

/**
 * ReturnValue
 *
 * @author Clevo
 * @date 2018/4/18
 */
public class ReturnValue<T> {

    public int ret = 1;
    public String msg;
    public T obj;

    public ReturnValue(int ret, String msg) {
        this.ret = ret;
        this.msg = msg;
    }

    public ReturnValue(String msg) {
        this.msg = msg;
    }

    public ReturnValue(String msg, T obj) {
        this.msg = msg;
        this.obj = obj;
    }

    public ReturnValue(T obj) {
        this.obj = obj;
    }

    public ReturnValue(int ret, String msg, T obj) {
        this.ret = ret;
        this.msg = msg;
        this.obj = obj;
    }

    @Override
    public String toString() {
        Gson gson = new Gson();
        return gson.toJson(this);
    }
}
